package tx.dingtalk;

import com.dingtalk.chatbot.DingtalkChatbotClient;
import com.dingtalk.chatbot.SendResult;
import com.dingtalk.chatbot.message.TextMessage;
import org.junit.Test;

import java.util.ArrayList;

public class TextMessageTest {
    private static DingtalkChatbotClient client = new DingtalkChatbotClient();

    public static void testSendTextMessage2(String msg) throws Exception {
        TextMessage message = new TextMessage(msg);
        SendResult result = client.send(TestConfig.CHATBOT_WEBHOOK, message);
        System.out.println(result);
    }

    public static void testSendTextMessage(String msg) throws Exception {
        TextMessage message = new TextMessage(msg);
        ArrayList<String> atMobiles = new ArrayList<String>();
        atMobiles.add("18600909436");
        message.setAtMobiles(atMobiles);

        SendResult result = client.send(TestConfig.CHATBOT_WEBHOOK, message);
        System.out.println(result);
    }
}
